package com.niiwoo.civet.account.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Decription 账单详情检索枚举
 *
 * @Author Jaylin
 * @Date 2017-12-14
 */
@AllArgsConstructor
@Getter
public enum BillDetailIndexEnum {


    RECHARGE(BillFirstSubjectEnum.USER_RECHARGE.getCode(), "充值说明", "充值类型",null),
    WITHDRAW_BACK(BillFirstSubjectEnum.USER_WITHDRAW_BACK.getCode(), "提现说明","退回原因","退回时间"),
    INVEST_REPAYMENT(BillFirstSubjectEnum.USER_INVEST_REPAYMENT.getCode(), "回款说明", "资金来源",null),
    INVEST_INVEST_BACK(BillFirstSubjectEnum.USER_INVEST_BACK.getCode(), "退回说明", "退款原因","退款时间"),
    GUARANTEE_BACK(BillFirstSubjectEnum.USER_GUARANTEE_BACK.getCode(), "退回说明", "退款原因", "退款时间"),
    GUARANTEE_INCOME(BillFirstSubjectEnum.USER_GUARANTEE_INCOME.getCode(), "收入说明", null,null),
    GUARANTEE_REPAYMENT(BillFirstSubjectEnum.USER_GUARANTEE_REPAYMENT.getCode(), "回款说明", "回款原因",null),
    GUARANTEE_PAY_BACK(BillFirstSubjectEnum.USER_GUARANTEE_PAY_BACK.getCode(), "返还说明",null,null),
    REPAYMENT_BACK(BillFirstSubjectEnum.USER_REPAYMENT_BACK.getCode(), "退回说明", "退款原因", "退款时间"),
    RED(BillFirstSubjectEnum.USER_RED.getCode(), "发放说明", "发放来源", null),
    PLATFORM_GIVEN(BillFirstSubjectEnum.USER_PLATFORM_GIVEN.getCode(), "发放说明", "发放来源", null),
    SUBSIDY(BillFirstSubjectEnum.USER_SUBSIDY.getCode(), "发放说明", "发放来源", null),
    TRANSFER_CREDITOR_IN(BillFirstSubjectEnum.USER_TRANSFER_CREDITOR.getCode(), "债转说明", null, null),

    MECHANISM_REPLACEMENT(BillFirstSubjectEnum.USER_MECHANISM_REPLACEMENT.getCode(), "机构代充", "机构代充", null),

    BORROW_INCOME(BillFirstSubjectEnum.USER_BORROW_INCOME.getCode(), "借款说明", null, null),
    TRANSFER_IN(BillFirstSubjectEnum.USER_TRANSFER_IN.getCode(), "充值说明", null, null),

    WITHDRAW(BillFirstSubjectEnum.USER_WITHDRAW.getCode(), "提现说明",null,null),
    BORROW(BillFirstSubjectEnum.USER_BORROW.getCode(), "借款说明", null, null),
    REPAYMENT(BillFirstSubjectEnum.USER_REPAYMENT.getCode(), "还款说明", "还款类型",null),
    INVEST(BillFirstSubjectEnum.USER_INVEST.getCode(), "投资说明", null,null),
    GUARANTEE_OUTCOME(BillFirstSubjectEnum.USER_GUARANTEE_OUTCOME.getCode(), "担保说明",null,null),
    GUARANTEE_PAY(BillFirstSubjectEnum.USER_GUARANTEE_PAY.getCode(), "垫付说明","垫付原因",null),
    TRANSFER_OUT(BillFirstSubjectEnum.USER_TRANSFER_OUT.getCode(), "充值说明", null, null),
    TRANSFER_CREDITOR_OUT(BillFirstSubjectEnum.USER_TRANSFER_CREDITOR_OUT.getCode(), "债转说明", null, null),
    ;

    private String firstCode;
    private String txDesc;
    private String backCause;
    private String backDate;

    /**
     * 根据code获取枚举对象
     * @param enumCode
     * @return
     */
    public static BillDetailIndexEnum getTxDescByFirstCode(String enumCode) {
        if (Objects.nonNull(enumCode)) {
            for (BillDetailIndexEnum retEnum : BillDetailIndexEnum.values()) {
                if (enumCode.equals(retEnum.getFirstCode())) {
                    return retEnum;
                }
            }
        }
        return null;

    }
}
